
public class Test {
   /* 杨辉三角形
   public static List<List<Integer>> generate(int numRows) {
        ArrayList<List<Integer>> lists = new ArrayList<>();
        ArrayList<Integer> integers1 = new ArrayList<>();
        //定义一个临时存储上一行结果的集合
        ArrayList<Integer> temp = integers1;
        for (int i = 1; i <= numRows; i++) {
            temp = getRow(temp, i);
            lists.add(temp);
        }
        return lists;
    }
    //该方法通过上一行的数据计算出本行的数据
    public static ArrayList<Integer> getRow(List<Integer> list, int n) {
        ArrayList<Integer> integers = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if (i == 0 || i == n - 1) {
                integers.add(1);
            } else {
                integers.add(list.get(i - 1) + list.get(i));
            }
        }
        return integers;
    }*/

    /* 链表的中间节点
    public ListNode middleNode(ListNode head) {
        if(head == null){
            return head;
        }
        ListNode fast = head;
        ListNode slow = head;
        while(fast!=null && fast.next!=null){
            fast = fast.next.next;
            slow=slow.next;
        }
        return slow;
    }*/


   /* 移除链表元素
   public ListNode removeElements(ListNode head, int val) {
        if(head==null){
            return head;
        }
        ListNode prev = head;
        ListNode cur = head.next;
        while(cur!=null){
            if(cur.val==val){
                prev.next=cur.next;
                cur=cur.next;
            }else{
                prev=cur;
                cur=cur.next;
            }
        }
        if(head.val==val){
            head=head.next;
        }
        return head;
    }*/


   /* 单链表逆置
   public ListNode reverseList(ListNode head) {
        if(head == null){
            return head;
        }
        ListNode cur = head.next;
        head.next = null;
        while(cur != null){
            ListNode curN = cur.next;
            cur.next = head;
            head = cur;
            cur = curN;
        }
        return head;
    }*/
}
